const app = getApp();
var utils = require('../../utils/utils.js')
// 定义一个全局变量保存从接口获取到的数据，以免重复请求接口
Page({

  /**
   * 页面的初始数据
   */
  data: {
    showCover:false,
    currentTab:0,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    wx.setNavigationBarTitle({
      title: options.catallTitle
    })
    this.setData({
      id: options.catallId,
    })

    var url = 'http://127.0.0.1:8000/catall/' + options.catallId + '/'
    utils.myRequest({
      url: url,
      methods: 'GET',
      success: function (res) {
        console.log(res);
        that.setData({
          result: res.data,
        })
      },
      fail: function () {

      }
    })
  },
  details: function (event){
    var works_id = event.currentTarget.dataset.id;
    wx.navigateTo({
      url: '/pages/details/details?WorksId=' + works_id,
    })
  }
})
